package com.ruoyi.web.controller.solidProdution;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.solidProdution.domain.ZckInfo;
import com.ruoyi.solidProdution.service.IZckInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 暂存库信息Controller
 * 
 * @author ruoyi
 * @date 2021-09-02
 */
@RestController
@RequestMapping("/solidProdution/zckInfo")
public class ZckInfoController extends BaseController
{
    @Autowired
    private IZckInfoService zckInfoService;

    /**
     * 查询暂存库信息列表
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zckInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZckInfo zckInfo)
    {
        startPage();
        List<ZckInfo> list = zckInfoService.selectZckInfoList(zckInfo);
        return getDataTable(list);
    }

    /**
     * 导出暂存库信息列表
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zckInfo:export')")
    @Log(title = "暂存库信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(ZckInfo zckInfo)
    {
        List<ZckInfo> list = zckInfoService.selectZckInfoList(zckInfo);
        ExcelUtil<ZckInfo> util = new ExcelUtil<ZckInfo>(ZckInfo.class);
        return util.exportExcel(list, "暂存库信息数据");
    }

    /**
     * 获取暂存库信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zckInfo:query')")
    @GetMapping(value = "/{zckId}")
    public AjaxResult getInfo(@PathVariable("zckId") Long zckId)
    {
        return AjaxResult.success(zckInfoService.selectZckInfoById(zckId));
    }

    /**
     * 新增暂存库信息
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zckInfo:add')")
    @Log(title = "暂存库信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZckInfo zckInfo)
    {
        return toAjax(zckInfoService.insertZckInfo(zckInfo));
    }

    /**
     * 修改暂存库信息
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zckInfo:edit')")
    @Log(title = "暂存库信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZckInfo zckInfo)
    {
        return toAjax(zckInfoService.updateZckInfo(zckInfo));
    }

    /**
     * 删除暂存库信息
     */
    @PreAuthorize("@ss.hasPermi('solidProdution:zckInfo:remove')")
    @Log(title = "暂存库信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{zckIds}")
    public AjaxResult remove(@PathVariable Long[] zckIds)
    {
        return toAjax(zckInfoService.deleteZckInfoByIds(zckIds));
    }
}
